<?php
return array(

	'attributeLabels' => array(
		'id' => 'ID',
		'name' => '酒店名',
		'image' => '图片',
		'province' => '地区',
		'city' => '市',
		'district' => '区',
		'star' => '酒店星级',
		'address' => '详细地址',
		'desc' => '酒店介绍',
		'facility' => '酒店设施',
		'tGuide' => '交通指南',
		'is_recommend' => '是否推荐',
		'type' => '类型',
		'ticket' => '门票价格',
		'phone' => '电话',
		'jingdu'=>'经度',
		'weidu'=>'纬度',
		'traffic' => '交通信息',
		'pingjia'=>'评价',
	),
	
	'cascade' => array(
		'facility', 'tGuide',
	),

	'rules'=>array(
		array('name,image,star', 'required'),
		array('desc', 'safe'),
		array('name', 'length', 'max'=>90),
		array('address', 'length', 'max'=>150),
		array('phone','numerical','integerOnly'=>true),
		array('phone','length','max'=>11),
		array('ticket','numerical','integerOnly'=>false),
		array('image','file','allowEmpty'=>true,'types'=>'jpg,gif,png','maxSize'=>1024*1024*500),
		array('searchCity,type,ticket,phone,jingdu,weidu,traffic,pingjia','safe')
	),

	'behaviors' => array(
		'search' => array(
			'class' => 'application.behaviors.SearchBehavior',
//			'priceSearch' => array(
//				'attribute' => 'price_agent',
//				'alias' => 'priceInfo',
//				'with' => 'items.goods.priceInfo',
//			),
			'searchModel' => 'CompanyHotelSearch'
		),
		'fileSaver' => array(
			'class' => 'lib.behaviors.ar.CFileSaveBehavior',
			'baseUrl' => Yii::app()->baseUrl . '/uploaded',
			'basePath' => dirname(Yii::app()->basePath) . '/uploaded',
			'attributes' => array('image'),
		),
		'fornt' => array(
			'class' => 'coms.behaviors.FrontBehavior',
			'attributes' => array(
				'title' => 'name',
				'img' => 'image',
				'desc' => 'desc'
			),
			'route' => 'provide/channel',
			'view' => 'hotelView'
		),
		'companyGoods' => array(
			'class' => 'coms.behaviors.goods.CompanyGoodsBehavior',
			'modelName' => 'GoodsHotel',
			'companyId' => 'hotel_id'
		),
		'minprice' => array(
			'class' => 'coms.behaviors.goods.MinPriceObjBehavior',
			'modelName' => 'Hotel',
			'relatedAttr' => 'hotel_id',
		),
		'citycondtion' => array(
			'class' => 'application.behaviors.CitySearchCondition',
			'citys' => array(
				'province',
				'city',
				'district'
			),
		),
	),

	'relations' => array(
		'items' => array(ActiveRecord::HAS_MANY, 'GoodsHotel', 'hotel_id'),
		'photo' => array(ActiveRecord::HAS_ONE, 'CompanyHotelAlbum', 'object_id'),
		'photoItems' => array(ActiveRecord::HAS_MANY, 'CompanyHotelAlbum', 'object_id'),
		'facility' => array(ActiveRecord::HAS_ONE, 'HotelFacility', 'hotel_id'),
		'tGuide' => array(ActiveRecord::HAS_MANY, 'HotelTrafficGuide', 'hotel_id'),
	),

	'_import' => array(
		array('*', 'models.ActiveRecord//*'),
	),
);